<template>
  <div>
    <h3>欢迎光临</h3>
    <span>{{eventBusData}}</span>
    <span>{{provideData}}</span>
    <br>
    <span>{{vuexData}}</span>
    <el-button type="primary" @click="userVuex">测试vuex</el-button>
  </div>
</template>
<script>
import { eventBus } from '../main'

export default {
  name: 'welcome',
  data () {
    return {
      eventBusData: '',
      provideData: this.provideTest.provideData,
      children: 'children',
      vuexData: ''
    }
  },
  methods: {
    userVuex () {
      this.$store.commit('modules1/changeUsername')
      this.vuexData = this.$store.state.modules1.username
    }
  },
  inject: ['provideTest'],
  created () {
    eventBus.$on('eventBusAction', (val) => {
      // console.log(1)
      this.eventBusData = val
    })
    console.log(this.$parent.$parent.$parent.$parent.parent)
    console.log(this.$options.data)
  },
  computed: {
    provideComputed () {
      return this.provideTest.provideData
    }
  }
}
</script>
<style lang="less" scoped>
</style>
